<?php

namespace pam\Service;

/**
 * Description of HealthIndicatorsService
 *
 * @author Robert Bwana <robert.bwana@ssra.go.tz>
 */
use pam\Service\IndicatorsServiceInterface;
use pam\Mapper\HealthPolicyIndicatorsDataAccess as spida;
use pam\Model\Indicator;

class HealthIndicatorsService implements IndicatorsServiceInterface {

    protected $indicatorDA;

    function __construct(spida $indicatorDA) {
        $this->indicatorDA = $indicatorDA;
    }

    public function deleteIndicator(Indicator $id) {
        $this->indicatorDA->delete($id->id);
    }

    public function findAllInPolicy($policyId) {
        return $this->indicatorDA->findAllInPolicy($policyId);
        
    }

    public function findIndicator($id) {
        return $this->indicatorDA->find($id);
    }

    public function saveIndicator(Indicator $indicator) {
        //try{
        $this->indicatorDA->save($indicator);
//        }  catch (\Exception $e){
//            die('Service error:' . $e);
//        }
    }

}
